import { UserConfigExport, ConfigEnv } from "vite";

import { viteMockServe } from "vite-plugin-mock";
import vue from "@vitejs/plugin-vue";
import { resolve } from "path";

export default ({ command }: ConfigEnv): UserConfigExport => {
  return {
    resolve: {
      alias: {
        "@": resolve(__dirname, "src"),
        "#": resolve(__dirname, "public"),
      },
    },
    plugins: [
      vue(),
      // viteMockServe({
      //   // default
      //   mockPath: "mock",
      //   enable: command === "serve",
      // }),
    ],
    server: {
      proxy: {
        "/api": {
          target: "http://htmlcode-system.test",
          changeOrigin: true,
          secure: false,
        },
        // "/api": {
        //   target: "http://localhost:5173",
        // },
      },
    },
  };
};
